import instance from '../../utils/request.js'

// 获取通知列表
export const getInfoListAPI = (params) => {
  const { pageSize, pageNum, keyword, authId, pub_date } = params
  return instance({
    url: '/api/info',
    method: 'GET',
    params: { pageSize, pageNum, keyword, authId, pub_date }
  })
}

// 获取通知内容
export const getInfoDetailAPI = (params) => {
  const { infoId } = params
  return instance({
    url: `/api/info/${infoId}`,
    method: 'GET',
  })
}

// 发布通知
export const publishInfoAPI = (data) => {
  const { coverImgUrl, publisher, title, content, authId } = data
  return instance({
    url: `/api/info`,
    method: 'POST',
    data: { coverImgUrl, publisher, title, content, authId }
  })
}

// 删除通知
export const deleteInfoAPI = (params) => {
  const { infoId, authId } = params
  return instance({
    url: `/api/info/${infoId}`,
    method: 'DELETE',
    params: { authId }
  })
}
